<template>
	<view class="content-wrap">
		<view class="segmented-padding-wrap">
			<uni-segmented-control :current="current" :values="items" v-on:clickItem="onClickItem" styleType="text" activeColor="#007aff"></uni-segmented-control>
		</view>
		<view class="content">
			<!-- <view v-show="current === 0">
				<information-item taskType="1"></information-item>
			</view>
			<view v-show="current === 1">
				<information-item taskType="0"></information-item>
			</view> -->
			<view>
				<information-item :taskType="current===0?'1':'0'" ref="informationItem"></information-item>
			</view>
		</view>
	</view>
</template>

<script>
	import informationItem from './informationItem'
	export default {
		components: {
			informationItem
		},
		data() {
			return {
				//顶部tab
				items: [
					'已读',
					'未读',
				],
				current: 1,//一进来是显示未读的页面
				showSearchArr: [false, false]
			}
		},
		onNavigationBarButtonTap() {
			this.showSearchArr[this.current] = !this.showSearchArr[this.current]
		},
		onLoad(param) {
			// console.log(param)
		},
		methods: {
			onClickItem(index) {
				if (this.current !== index) {
					this.current = index;
					//改变子组件的事件
					this.$refs.informationItem.setTaskType(this.current===0?'1':'0')
				}
			}
		}
	}
</script>

<style scoped>
	.segmented-padding-wrap {
		border-bottom: 1px solid rgba(0, 0, 0, 0.2);
		z-index: 1;
	}

	.content-wrap {
		display: flex;
		flex-direction: column;
		flex: 1;
	}

	.content {
		/* background: #FFFFFF; */
		padding-top: 90upx;
		border-top: 1upx solid #DBDBDB;
	}

	.segmented-padding-wrap {
		position: fixed;
		left: 0;
		top: 0;
		width: 750upx;
		background-color: #ffffff;
	}
</style>
